package org.csu.gp_store.bo;

import lombok.Data;
import org.csu.gp_store.entity.*;

import java.math.BigDecimal;
import java.sql.Timestamp;

@Data
public class EvaluationBO {

    private String indexID;
    private String accountID;
    private String itemID;
    private String orderID;
    private String productID;
    private double rate;
    private String comment;
    private String reComment;
    private  String productName;
    private Timestamp time;
    private BigDecimal price;
    private Integer quantity;
    private String  style;
    private String image;
    public  static EvaluationBO toEvaluationBO(Evaluation evaluation,OrderItem orderItem,Product product,Item item){
        EvaluationBO evaluationBO=new EvaluationBO();
        evaluationBO.setIndexID(String.valueOf(evaluation.getIndexID()));
        evaluationBO.setAccountID(String.valueOf(evaluation.getAccountID()));
        evaluationBO.setItemID(String.valueOf(item.getItemID()));
        evaluationBO.setOrderID(String.valueOf(orderItem.getOrderID()));
        evaluationBO.setProductID(String.valueOf(product.getProductID()));
        evaluationBO.setRate(evaluation.getRate());
        evaluationBO.setComment(evaluation.getComment());
        evaluationBO.setReComment(evaluation.getReComment());
        evaluationBO.setProductName(product.getProductName());
        evaluationBO.setPrice(item.getPrice());
        evaluationBO.setQuantity(orderItem.getQuantity());
        evaluationBO.setStyle(item.getStyle());
        evaluationBO.setImage(item.getImage());
        evaluationBO.setTime(evaluation.getTime());
        return evaluationBO;
    }
}
